package com.lx.test.handle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.lx.test.dao.UserDao;
import com.lx.test.entity.User;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lxl on 2016/5/4.
 */
@Controller
@RequestMapping("add/user")
public class SaveUser {

    @Autowired
    private UserDao userDao ;

    @RequestMapping( method = RequestMethod.POST)
    public @ResponseBody
    Map process( @RequestBody User user ){

        userDao.save(user);

        HashMap map = new HashMap<String,Object>() ;

        map.put("user",user) ;

        return map ;

    }


}
